home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_13_09 / welstead / cwdlg.h < prev    next >
C/C++ Source or Header  |  1995-05-20  |  3KB  |  89 lines

  1. //  File CWDLG.H  Header file for tdialog classes  
  2.  
  3. #ifndef CWDLG_H
  4. #define CWDLG_H
  5.  
  6. #include "cwobj.h"
  7.  
  8. // Define this for Win32 and Windows NT:
  9. // #define WIN_32
  10. // Borland uses __FLAT__
  11. // Symantec uses __NT__ 
  12. #ifdef WIN_32  
  13. #define GET_WM_COMMAND_CMD(wp,lp)    HIWORD(wp)
  14. #else   // 16 bit Windows
  15. #define GET_WM_COMMAND_CMD(wp,lp)    HIWORD(lp)
  16. #endif
  17.  
  18. extern HINSTANCE gdlg_instance;
  19. // Must be set to current instance
  20. // before using any dialogs.
  21.  
  22. int check_gdlg_instance (void);
  23.  
  24. class tdialog {
  25.    public:
  26.    LPCSTR rc_title,caption_title;
  27.    HWND hwndParent,hdialog;
  28.    BOOL dlg_return_value;
  29.    DLGPROC lpDialogProc;
  30.    tdialog (HWND Parent,LPCSTR resource_name,
  31.          LPCSTR caption_name);
  32.    virtual void center_dialog (void);
  33.    virtual BOOL respond_wm_initdialog (void);
  34.     virtual BOOL respond_wm_command (WPARAM wParam,
  35.         LPARAM lParam);
  36.    virtual BOOL handle_message (HWND hwnd,UINT message,
  37.                 WPARAM wParam,LPARAM lParam);
  38.    virtual BOOL exec_dialog (void);
  39.    virtual ~tdialog (void); };
  40.  
  41. #define MAX_INPUT_LENGTH 80
  42.  
  43. class tinput_dialog: public tdialog {
  44.    public:
  45.    char input_text [MAX_INPUT_LENGTH + 1];
  46.    LPCSTR input_caption;
  47.    int input_id,input_caption_id;
  48.    tinput_dialog (HWND Parent,LPCSTR caption_name,
  49.        LPCSTR input_name,LPCSTR init_text);
  50.    virtual BOOL respond_wm_initdialog(void);
  51.     virtual BOOL respond_wm_command (WPARAM wParam,
  52.        LPARAM lParam);
  53.    virtual BOOL exec_dialog (void);
  54.    virtual ~tinput_dialog (void); };
  55.  
  56. class tlist_dialog: public tdialog {
  57.    public:
  58.    int selected;
  59.    tlist_box_data *list_box_data;
  60.    LPCSTR list_box_descr;
  61.    tlist_dialog (HWND Parent,LPCSTR caption_name,
  62.      LPCSTR descr_name,tlist_box_data
  63.          *the_data_rec,int init_selected);
  64.    virtual void set_data (tlist_box_data *data_rec);
  65.    virtual void get_data (tlist_box_data *data_rec);
  66.    virtual BOOL respond_wm_initdialog(void);
  67.    virtual BOOL respond_wm_command (WPARAM wParam,
  68.              LPARAM lParam);
  69.    virtual void set_selected (int sel);
  70.    virtual LPSTR get_item_string (int item);
  71.    virtual void clear_list_box (void);
  72.    virtual BOOL exec_dialog (void);
  73.    virtual ~tlist_dialog (void); };
  74.  
  75. class tdata_list_dialog: public tlist_dialog {
  76.    public:
  77.    tdata_list_dialog (HWND Parent,LPCSTR caption_name,
  78.         LPCSTR descr_name,tlist_box_data
  79.         *the_data_rec,int init_selected):
  80.    tlist_dialog (Parent,caption_name,descr_name,
  81.             the_data_rec,init_selected) { } ;
  82.    virtual BOOL respond_wm_command (WPARAM wParam,
  83.         LPARAM lParam);
  84.    virtual LPSTR get_item_string (int item);
  85.    virtual BOOL exec_dialog (void);
  86.    };
  87. #endif
  88.  
  89.